<template>
  <header class="header">
    <h1>todos</h1>
    <input
      class="new-todo"
      autofocus
      autocomplete="off"
      placeholder="What needs to be done?"
      @keydown.enter="addTodo"
    />
  </header>
</template>

<script lang="ts" setup>
import useTodoStore from '../stores/todo';
let store = useTodoStore();

let addTodo = (e: KeyboardEvent) => {
  const inputEl = e.target as HTMLInputElement;
  store.addTodo(inputEl.value);
  inputEl.value = '';
};
</script>
